package com.woniuxy.micropromotionserver.promotionmag.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.micropromotionserver.bean.PageRequest;
import com.woniuxy.micropromotionserver.bean.PromotionBean;
import com.woniuxy.micropromotionserver.promotionmag.mapper.PromotionOrderMapper;
import com.woniuxy.micropromotionserver.promotionmag.service.IPromotionOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class PromotionOrderImpl implements IPromotionOrderService {

    @Resource
    private PromotionOrderMapper promotionOrderMapper;

    /**
     * 1 根据参数进行分页查询
     * @param request 分页请求对象
     * @param promotionBean 条件  促销单类型   1订单   2商品
     * @return
     */
    @Override
    public PageInfo<PromotionBean> findByPromoType(PageRequest request, PromotionBean promotionBean) {
        return PageHelper.startPage(request.getPageNum(),request.getLimit()).
                doSelectPageInfo(()->promotionOrderMapper.findByPromoType(request,promotionBean));
    }
}
